Skip to content

Support MSSQL (and --entra-user) in pgdb migrate; bump to 0.12.0 - #46

Merged
aersam merged 3 commits into
mainfrom
migrate-mssql
Oct 5, 2026
Merged

aersam merged 3 commits into
mainfrom
migrate-mssql

Conversation

@aersam

@aersam aersam commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • `pgdb migrate check` / `apply` accept `--dialect mssql` (library functions in `pgdevkit.migrate` take `dialect=`); Postgres stays the default.
  • MSSQL implementation in new `pgdevkit/migrate_mssql.py`: files split on `GO` lines and run in one transaction (rolled back on failure), `[schema].[table]` tracking table (default `dbo.schema_migrations`), `OBJECT_ID`-based post-apply verification, and conservative `--ask` already-applied detection (single-statement table/view/schema/add-column batches only).
  • `--entra-user` with MSSQL appends `Authentication=ActiveDirectoryDefault` so mssql-python gets an Entra token via `DefaultAzureCredential` (needs the `azure` extra). The flag value only switches Entra auth on.
  • `missing_privileges` raises `NotImplementedError` for MSSQL.
  • Version bump 0.11.0 → 0.12.0; README updated.

Test plan

  • `pytest -m "not mssql"` (unit tests use a fake MSSQL connection) and `ty check` pass locally
  • `tests/test_migrate_mssql_live.py` (`mssql` marker) against a real SQL Server — not run locally (no Docker); relies on the `mssql-test` CI job
  • Entra auth against a real Azure SQL database — untested

🤖 Generated with Claude Code

@aersam
aersam merged commit ee6928b into main Oct 5, 2026
2 checks passed
aersam and others added 3 commits October 5, 2026 20:06
Adds an MSSQL implementation of the migrate primitives (GO-batch splitting,
single-transaction apply, OBJECT_ID-based verification and already-applied
detection, [schema].[table] tracking). Postgres remains the default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Appends Authentication=ActiveDirectoryDefault so mssql-python acquires the
Entra token via DefaultAzureCredential.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…alect tracking table key, strip block comments, mssql extra hint; --entra-user in compare

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant